package com.seelyn.rhea.mvc.route;

import com.seelyn.rhea.mvc.context.Request;
import com.seelyn.rhea.mvc.internal.PathRepeatException;

import java.util.List;

/**
 * @author linfeng
 * @since 2016/1/25
 */
public interface BuilderFactory {

    BuilderRoute route(Route route);

    BuilderFilter filter(Filter filter);

    BuilderResolver resolver(Resolver resolver);

    interface Query {
        RouteMatching getRoute(Request request);
        List<FilterMatching> getBeforeFilters(Request request);
        List<FilterMatching> getAfterFilters(Request request);
    }

    interface BuilderRoute {
        BuilderRoute get(String path) throws PathRepeatException;
        BuilderRoute head(String path) throws PathRepeatException;
        BuilderRoute post(String path) throws PathRepeatException;
        BuilderRoute put(String path) throws PathRepeatException;
        BuilderRoute patch(String path) throws PathRepeatException;
        BuilderRoute delete(String path) throws PathRepeatException;
        BuilderRoute options(String path) throws PathRepeatException;
        BuilderRoute trace(String path) throws PathRepeatException;
    }

    interface BuilderFilter {
        BuilderFilter before(String path);
        BuilderFilter after(String path);
    }

    interface BuilderResolver {

        BuilderResolver all(String path) throws PathRepeatException;

        BuilderResolver get(String path) throws PathRepeatException;
        BuilderResolver head(String path) throws PathRepeatException;
        BuilderResolver post(String path) throws PathRepeatException;
        BuilderResolver put(String path) throws PathRepeatException;
        BuilderResolver patch(String path) throws PathRepeatException;
        BuilderResolver delete(String path) throws PathRepeatException;
        BuilderResolver options(String path) throws PathRepeatException;
        BuilderResolver trace(String path) throws PathRepeatException;
    }


}
